<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" 
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:sf="http://www.springframework.org/tags/faces"
	template="/WEB-INF/layouts/standard.xhtml">

	<ui:define name="content">
	<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id6" /> 
		<ui:fragment id="obraSearchFragment">
			<div id="gastosSearch" class="section">
				<span class="errors">
					<p:messages globalOnly="true" /> 
				</span>

			<h3>Filtrar:</h3> 
			<h:form id="gastoObraForm">
			<fieldset>
				<div class="field">
					<div class="label">Nombre:</div>
					<p:autoComplete value="#{searchGasto.name}" style="width:45%"  minQueryLength="2" completeMethod="#{gastoController.autoCompleteSuggestions}"/> 
				</div>
				<br />
				<br />
				<br />
		
				<div class="field">
					<div  class="label">Dia Efectuado:</div>
					<h:inputText style="width:40%" id="diaEfectuado" value="#{searchGasto.diaEfectuadoString}"/>
					<script type="text/javascript">
						  Calendar.setup({
						        inputField     :    "gastoObraForm:diaEfectuado",
						        ifFormat       :    "%d/%m/%Y",
						        showsTime      :    false,
						        timeFormat     :    "24",
						    });
					</script>
				</div>
				<div class="field">
					<div class="label">Precio:</div>
					<sf:clientTextValidator style="width:20%" regExp="^[-]?([1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|\.[0-9]{1,2})$" invalidMessage="El campo I.V.A debe contener solo valores numericos y de dos decimales maximo">				
						<h:inputText id="price" value="#{searchGasto.price}"/>
					</sf:clientTextValidator>	
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="categoriaName">Categoria:</h:outputLabel>
					</div>
					<div class="input">
						<h:selectOneMenu id="tipoDeGastos" value="#{searchGasto.categoriaName}">
							<f:selectItems value="#{referenceData.tipoDeGastos}"/>
						</h:selectOneMenu>		
					</div>   
				</div>
				<div class="field">
					<div class="label">
						<h:outputLabel for="factura">Tipo De Factura:</h:outputLabel>
					</div>
				<div class="input">
					<h:selectOneMenu id="material" value="#{searchGasto.factura}">
						<f:selectItems value="#{referenceData.tipoDeFacturas}"/>
					</h:selectOneMenu></div>
				</div>
			
			
				<div class="field">
					<div class="label">
						<h:outputLabel for="factura">Buscar en :</h:outputLabel>
					</div>
					<div class="input">
						<h:selectOneMenu id="expenseType" value="#{searchGasto.expenseType}">
							<f:selectItems value="#{referenceData.typesOfExpenses}"/>
						</h:selectOneMenu>
					</div>
				</div>
			</fieldset>

			<div class="buttonGroup">
				<sf:commandButton id="filtrarGastos"  value="Filtrar" processIds="*" action="search" /> 
				<sf:commandButton id="volver"  value="Volver" action="volver" /> 
			</div>
			
			</h:form>
			</div>
    	</ui:fragment>
	</ui:define>
</ui:composition>

